package com.alorm.core.sqlgen;

public class Dependance {
	private Class dClass;

	private Class gClass;

	private int typeRelation;

	public static final int SIMPLE_POJO = 0;

	public static final int UNI_ONE_TO_MANY = 112;
	public static final int BI_ONE_TO_MANY = 212;

	public static final int UNI_ONE_TO_ONE = 111;
	public static final int BI_ONE_TO_ONE = 211;

	public static final int BI_MAY_TO_MANY = 222;
	public static final int UNI_MAY_TO_MANY = 122;

	public Dependance(Class gClass, Class dClass, int typeRelation) {
		this.dClass = dClass;
		this.gClass = gClass;
		this.typeRelation = typeRelation;
	}

	public boolean hasSameExtremities(Dependance d) {

		return ((d.dClass == dClass && d.gClass == gClass) || (d.dClass == gClass && d.gClass == dClass));
	}

	public String toString() {
		return gClass.getName() + " --- " + typeRelation + " --- "
				+ dClass.getName();
	}

	public Class getdClass() {
		return dClass;
	}

	public void setdClass(Class dClass) {
		this.dClass = dClass;
	}

	public Class getgClass() {
		return gClass;
	}

	public void setgClass(Class gClass) {
		this.gClass = gClass;
	}

	public int getTypeRelation() {
		return typeRelation;
	}

	public void setTypeRelation(int typeRelation) {
		this.typeRelation = typeRelation;
	}

}
